﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;

namespace AnyOffice.general.system.code
{
    public partial class func : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = (Request.QueryString["code_no"] != null) ? Request.QueryString["code_no"].ToString() : "";
            this.ViewState["CodeNo"] = str;
            string commandText = "SELECT * FROM [dbo].[Sys_Code] WHERE [CodeNo]=@CodeNo AND [CodeFlag] IS NULL";
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@CodeNo", SqlDbType.NVarChar, 200) };
            commandParameters[0].Value = str;
            DataTable table = SqlHelper.ExecuteDataset(base.Conn, CommandType.Text, commandText, commandParameters).Tables[0];
            if (table.Rows.Count > 0)
            {
                this.litCodeName.Text = table.Rows[0]["CodeName"].ToString();
            }
            commandText = "SELECT * FROM [dbo].[Sys_Code] WHERE [CodeFlag]=@CodeNo ORDER BY [CodeId] ASC";
            DataTable table2 = SqlHelper.ExecuteDataset(base.Conn, CommandType.Text, commandText, commandParameters).Tables[0];
            if (table2.Rows.Count > 0)
            {
                this.rptCode.DataSource = table2;
                this.rptCode.DataBind();
            }
        } 

    }
}
